using System;
using System.Collections.Generic;
using Microsoft.Rtc.Collaboration.Presence;

namespace Lync.Widget.Library.Presence
{
    public static class AvailabilityCriteriaConverter
    {
        public static List<PresenceAvailability> Convert(string availability)
        {
            var criteria = new List<PresenceAvailability>();

            if (!String.IsNullOrEmpty(availability))
            {
                switch (availability.ToLower().Trim())
                {
                    case "yes": criteria.AddRange(new List<PresenceAvailability> { PresenceAvailability.Online }); break;
                    case "ant": criteria.AddRange(new List<PresenceAvailability> { PresenceAvailability.Online, PresenceAvailability.Busy }); break;
                    case "busy": criteria.AddRange(new List<PresenceAvailability> { PresenceAvailability.Busy }); break;
                    case "away": criteria.AddRange(new List<PresenceAvailability> { PresenceAvailability.Away }); break;
                }
            }

            return criteria;
        }
    }
}